import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import './styles/tech.scss'

const app = createApp(App)

// 全局请求拦截器 - 自动添加 token
const originalFetch = window.fetch
window.fetch = (...args) => {
  const [url, options = {}] = args
  const token = localStorage.getItem('auth_token')
  
  const newOptions = {
    ...options,
    headers: {
      ...options.headers,
      'Authorization': token ? `Bearer ${token}` : ''
    }
  }
  
  return originalFetch(url, newOptions)
}
app.use(router)
app.use(ElementPlus)
app.mount('#app')